<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj={
           name:"黄晓霞",
           age:22,
           sex:"女",
           hobby:["追剧","游泳","逛街"],
           height:162,
           score:88,
           address:"上海宝山",
           sayHello:function(){
            return("hello，我叫"+obj.name+"今年"+obj.age+"岁了"+"是一名"+obj.sex+"生"+"现在住在"+obj.address+"我的兴趣爱好是"+obj.hobby+"我的身高是"+obj.height)
           }
        }
        console.log(obj)
        console.log(obj.sayHello())
        console.log(obj.name)//查
        obj.job="程序员";//增
        console.log(obj.job);
        console.log(obj);
        delete obj.job;//删
        console.log(obj.job);
        obj.age=18;
        console.log(obj.age)
        //点语法不能解析变量，只能根据具体的键名获取，需要通当对象的键名是在变量中，过这个变量解析对应的键名时，要使用中括号语法
        var str="hobby";
        console.log(obj[str]);//等于：obj.hobby
        //如果中括号语法内放置具体的的键名，需要将键名写成字符的形式
        console.log(obj["name"])
    </script>
</body>
</html>